import request from '@/utils/request'
import { getToken } from '@/utils/auth'

// 品类查询
export function listCategory(query) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/category/list',
    method: 'get',
    params: query
  })
}

// 网点品类查询
export function networkListCategory(query) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/category/networkList',
    method: 'get',
    params: query
  })
}

// 保存
export function saveCategory(data) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/category/save',
    method: 'post',
    data
  })
}

// 保存网点品类
export function saveNetworkCategory(data) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/category/editNetworkCategory',
    method: 'post',
    data
  })
}

// 删除
export function deleteCategory(id) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/category/delete/' + id,
    method: 'get'
  })
}

// 叶子品类查询
export function listLeafCategory(query) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/category/getLeafCategory',
    method: 'get',
    params: query
  })
}
// 合作商品类查询
export function listPartnerCategory(query) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/category/getPartnerCategory',
    method: 'get',
    params: query
  })
}
